﻿Public Class CPUmeter
    Dim PC As PerformanceCounter
  


    Dim cpu1 As Integer
    Dim ram As Integer
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Enabled = True


        PC.CategoryName = "Process"
        PC.CounterName = "Private Bytes"
        PC.InstanceName = "Explorer"
        MessageBox.Show(PC.NextValue().ToString())


    End Sub

    Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        cpu1 = PerformanceCounter1.NextValue

        If ProgressBar1.Value < 1 Then
            ProgressBar1.Value += 1
        ElseIf ProgressBar1.Value > 1 Then
            ProgressBar1.Value -= 1
        End If

        Label2.Text = ProgressBar1.Value.ToString + "%"


    End Sub

End Class
